package com.example.demo.entity;

import com.alibaba.fastjson2.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.mybatisflex.annotation.Id;
import com.mybatisflex.annotation.KeyType;
import com.mybatisflex.annotation.Table;
import java.io.Serializable;
import java.time.LocalDateTime;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;

/**
 *  实体类。
 *
 * @author zql
 * @since 2024-02-05
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Table(value = "tb_soft")
public class Soft implements Serializable {

    @Id(keyType = KeyType.Auto)
    private Long id;

    private String softName;

    private String softVersion;

    private String gitUrl;

    private String officialUrl;

    private String mainLanguage;

    private String languages;

    private Integer star;

    private String uuid;

    private String softId;

    // DateTimeFormat 入参格式化 JsonFormat 出参格式化
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(
            pattern = "yyyy-MM-dd HH:mm:ss",
            timezone = "GMT+8"
    )
    @JSONField(name="created_at", format="yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createdAt;

    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(
            pattern = "yyyy-MM-dd HH:mm:ss",
            timezone = "GMT+8"
    )
    @JSONField(name="updated_at", format="yyyy-MM-dd HH:mm:ss")
    private LocalDateTime updatedAt;

}
